package co.yixiang.yshop.module.crm.controller.admin.crmindex.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;

import java.util.List;

@Schema(description = "管理后台 - 地区统计 Response VO")
@Data
@Builder
public class RegionStatisticsVO {

    @Schema(description = "省份统计列表")
    private List<ProvinceStatistics> provinceStatistics;

    @Schema(description = "城市统计列表")
    private List<CityStatistics> cityStatistics;

    @Schema(description = "地区统计列表")
    private List<AreaStatistics> areaStatistics;

    @Schema(description = "地图数据格式 - 用于中国地图可视化")
    private List<MapDataItem> mapData;

    @Schema(description = "总线索数")
    private Long totalCount;

    @Schema(description = "有地区信息的线索数")
    private Long regionCount;

    @Schema(description = "无地区信息的线索数")
    private Long noRegionCount;

    @Data
    @Builder
    public static class ProvinceStatistics {
        @Schema(description = "省份编码")
        private Integer provinceCode;

        @Schema(description = "省份名称")
        private String provinceName;

        @Schema(description = "线索数量")
        private Long count;

        @Schema(description = "占比百分比")
        private String percentage;
    }

    @Data
    @Builder
    public static class CityStatistics {
        @Schema(description = "城市编码")
        private Integer cityCode;

        @Schema(description = "城市名称")
        private String cityName;

        @Schema(description = "省份编码")
        private Integer provinceCode;

        @Schema(description = "省份名称")
        private String provinceName;

        @Schema(description = "线索数量")
        private Long count;

        @Schema(description = "占比百分比")
        private String percentage;
    }

    @Data
    @Builder
    public static class AreaStatistics {
        @Schema(description = "地区编码")
        private Integer areaCode;

        @Schema(description = "地区名称")
        private String areaName;

        @Schema(description = "城市编码")
        private Integer cityCode;

        @Schema(description = "城市名称")
        private String cityName;

        @Schema(description = "省份编码")
        private Integer provinceCode;

        @Schema(description = "省份名称")
        private String provinceName;

        @Schema(description = "线索数量")
        private Long count;

        @Schema(description = "占比百分比")
        private String percentage;
    }

    @Data
    @Builder
    public static class MapDataItem {
        @Schema(description = "地区名称")
        private String name;

        @Schema(description = "地区编码")
        private String code;

        @Schema(description = "数值")
        private Long value;

        @Schema(description = "坐标信息")
        private Coordinate coordinate;

        @Data
        @Builder
        public static class Coordinate {
            @Schema(description = "经度")
            private Double lng;

            @Schema(description = "纬度")
            private Double lat;
        }
    }
}
